package com.wnzt.baszh.controller;

import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import net.netca.pki.Certificate;
import net.netca.pki.DeviceSet;
import net.netca.pki.PkiException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wnzt.baszh.ca.CAUtil;
import com.wnzt.baszh.ca.NetcaPKI;
import com.wnzt.baszh.entity.Tsysuser;
import com.wnzt.baszh.service.IArchivingService;
import com.wnzt.baszh.util.common.CryptoUtil;
import com.wnzt.baszh.util.common.FTPUtil;
import com.wnzt.baszh.util.common.FileEncodeAndDecode;
import com.wnzt.baszh.util.common.FileUtil;
import com.wnzt.baszh.util.common.GlobalStatic;
import com.wnzt.baszh.util.common.PageHelper;
import com.wnzt.baszh.util.common.SetSystemProperty;
/**
 * 归档Controller
 * @author dqw
 * @date 2017-5-16
 */
@Controller
@RequestMapping("/Archiving")
public class ArchivingController {
	
	@Autowired
	private IArchivingService archivingService; 
	
	//跳转病案集中归档页面
	@RequestMapping("/ArchivingList")
	public String ArchivingList(){
		return "Archiving/ArchivingList";
	}
	
	//跳转病案归档查询页面
	@RequestMapping("/ArchivingQuery")
	public String ArchivingQuery(){
		return "Archiving/ArchivingQuery";
	}
	
	//跳转病案归档统计页面
	@RequestMapping("/ArchivingStatistics")
	public String ArchivingStatistics(){
		return "Archiving/ArchivingStatistics";
	}
	
	//跳转病案浏览历史
	@RequestMapping("/BrowseHistory")
	public String BrowseHistory(){
		return "Browse/BrowseHistory";
	}
	
	//病案浏览日志查询
	@RequestMapping("/BrowseLogQuery")
	public String BrowseLogQuery(){
		return "Browse/BrowseLogQuery";
	}
	
	//跳转病案申请记录页面
	@RequestMapping("/ApplyRecord")
	public String ApplyRecord(){
		return "Archiving/ApplyRecord";
	}
	
	//跳转病案批量申请记录页面
	@RequestMapping("/BatchApplyRecord")
	public String BatchApplyRecord(){
		return "Archiving/BatchApplyRecord";
	}
	
	//跳转病案批量申请记录列表页
	@RequestMapping("/BatchApplyList")
	public String BatchApplyList(){
		return "Archiving/BatchApplyList";
	}
/*----------------------------------------------------------------------------------*/	
	/**
	 * 获取出院病室
	 * @param request
	 * @return
	 */
	@RequestMapping("/getFcybs")
    @ResponseBody
    public Object getFcybs(HttpServletRequest request){
		String ksbh = request.getParameter("ksbh"); //科室编号
		String fcode = request.getParameter("fcode"); //当前用户编码
		List<Map<String, Object>> list=null;
		try {
			list = archivingService.getFcybs(ksbh,fcode);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
	
	/**
	 * 根据当前用户获取对应的科室
	 * @param request
	 * @return
	 */
	@RequestMapping("/getDeptByFcode")
    @ResponseBody
    public Object getDeptByFcode(HttpServletRequest request){
		String fcode = request.getParameter("fcode");
		List<Map<String, Object>> resultList=null;
		try {
			resultList = archivingService.getDeptByFcode(fcode);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return resultList;
	}
	
	/**
	 * 根据当前用户获取对应的病区
	 * @param request
	 * @return
	 */
	@RequestMapping("/getBQByFcode")
    @ResponseBody
    public Object getBQByFcode(HttpServletRequest request){
		String fcode = request.getParameter("fcode");
		List<Map<String, Object>> resultList=null;
		try {
			resultList = archivingService.getBQByFcode(fcode);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return resultList;
	}
	/**
	 * 查询病案集中归档数据
	 * @param request
	 * @return
	 */
	@RequestMapping("/queryArchiving")
    @ResponseBody 
    public Object queryArchiving(HttpServletRequest request){
		String date1 = request.getParameter("date1");
		String date2 = request.getParameter("date2");
		String fcydept = request.getParameter("fcydept");
		String fzzDoc = request.getParameter("fzzDoc");
		String fprn = request.getParameter("fprn");
		String fname = request.getParameter("fname");
		String fcybq = request.getParameter("fcybq");
		String status = request.getParameter("status");
		String day = request.getParameter("day");
		String page = request.getParameter("page");
    	String rows = request.getParameter("rows");
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("date1", date1);
		map.put("date2", date2);
		map.put("fcydept", fcydept);
		map.put("fzzDoc",fzzDoc );
		map.put("fprn", fprn);
		map.put("fname", fname);
		map.put("fcybq", fcybq);
		map.put("status", status);
		map.put("day", day);
		map.put("page", page);
     	map.put("rows", rows);
		PageHelper pageHepler=null;
		try {
			pageHepler = archivingService.queryArchiving(map);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return pageHepler;
	}
	
	/**
	 * 根据住院ID获取归档总数
	 * @param request
	 * @return
	 */
	@RequestMapping("/getArchivingByFzyid")
    @ResponseBody 
    public Object getArchivingByFzyid(HttpServletRequest request){
		String fzyids = request.getParameter("fzyids");
		List<List<Map<String, Object>>> list=null;
		try {
			list = archivingService.getArchivingByFzyid(fzyids);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
	
	/**
	 * 获取所有已归档和未归档数据
	 * @param request
	 * @return
	 */
	@RequestMapping("/queryAllArchiving")
    @ResponseBody 
    public Object queryAllArchiving(HttpServletRequest request){
		String date1 = request.getParameter("date1");
		String date2 = request.getParameter("date2");
		String fcydept = request.getParameter("fcydept");
		String fzzDoc = request.getParameter("fzzDoc");
		String fprn = request.getParameter("fprn");
		String fname = request.getParameter("fname");
		String fcybq = request.getParameter("fcybq");
		String status = request.getParameter("status");
		String rqlx = request.getParameter("rqlx");
		String day = request.getParameter("day");
		String jsDay = request.getParameter("jsDay");
		String yqDay = request.getParameter("yqDay");
		String ycyDay = request.getParameter("ycyDay");
		String page = request.getParameter("page");
    	String rows = request.getParameter("rows");
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("date1", date1);
		map.put("date2", date2);
		map.put("fcydept", fcydept);
		map.put("fzzDoc",fzzDoc );
		map.put("fprn", fprn);
		map.put("fname", fname);
		map.put("fcybq", fcybq);
		map.put("status", status);
		map.put("day", day);
		map.put("jsDay", jsDay);
		map.put("yqDay", yqDay);
		map.put("ycyDay", ycyDay);
		map.put("rqlx", rqlx);
		map.put("page", page);
     	map.put("rows", rows);
     	PageHelper resultPage=null;
		try {
			resultPage = archivingService.queryAllArchiving(map);
		} catch (Exception e) {
			e.printStackTrace();
		}
     	return resultPage;
	}
	
	/**
	 * 获取所有病区
	 * @param request
	 * @return
	 */
	@RequestMapping("/getAllFcybs")
    @ResponseBody 
    public Object getAllFcybs(HttpServletRequest request){
		String ksbh = request.getParameter("ksbh"); //科室编号
		List<Map<String, Object>> list=null;
		try {
			list = archivingService.getAllFcybs(ksbh);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
	
	/**
	 * 获取归档统计数据
	 * @param request
	 * @return
	 */
	@RequestMapping("/queryStatistics")
    @ResponseBody 
    public Object queryStatistics(HttpServletRequest request){
		String date1 = request.getParameter("date1");
		String date2 = request.getParameter("date2");
		String fcydept = request.getParameter("fcydept");
		String rqlx = request.getParameter("rqlx");
		String jsday = request.getParameter("jsday");
		String yqday = request.getParameter("yqday");
		String page = request.getParameter("page");
    	String rows = request.getParameter("rows");
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("date1", date1);
		map.put("date2", date2);
		map.put("fcydept", fcydept);
		map.put("rqlx", rqlx);
		map.put("jsday", jsday);
		map.put("yqday", yqday);
		map.put("page", page);
		map.put("rows", rows);
		PageHelper helper=null;
		try {
			helper = archivingService.queryStatistics(map);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return helper;
	}
	
	/**
	 * 根据科室统一编号获取逾期归档记录
	 * @param request
	 * @return
	 */
	@RequestMapping("/getYqgdData")
    @ResponseBody 
    public Object getYqgdData(HttpServletRequest request){
		String fcytykh = request.getParameter("fcytykh");
		boolean wgd = Boolean.parseBoolean(request.getParameter("wgd"));
		boolean yqgd = Boolean.parseBoolean(request.getParameter("yqgd"));
		Integer jsday = Integer.parseInt(request.getParameter("jsday"));
		Integer yqday = Integer.parseInt(request.getParameter("yqday"));
		String page = request.getParameter("page");
    	String rows = request.getParameter("rows");
    	Map<String, Object> map = new HashMap<String, Object>();
    	map.put("fcytykh", fcytykh);
    	map.put("jsday", jsday);
    	map.put("yqday", yqday);
    	map.put("page", page);
    	map.put("rows", rows);
    	map.put("wgd", wgd);
    	map.put("yqgd", yqgd);
		PageHelper result=null;
		try {
			result = archivingService.getYqgdData(map);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return result;
	}
	
	/**
	 * 获取浏览过的病历
	 * @param request
	 * @return
	 */
	@RequestMapping("/queryBrowseHistory")
    @ResponseBody 
    public Object queryBrowseHistory(HttpServletRequest request){
		String date1 = request.getParameter("date1");
		String date2 = request.getParameter("date2");
		String fcydept = request.getParameter("fcydept");
		String fzzDoc = request.getParameter("fzzDoc");
		String fprn = request.getParameter("fprn");
		String fname = request.getParameter("fname");
		String jbType = request.getParameter("jbType");
		String jbName = request.getParameter("jbName");
		String oType = request.getParameter("oType");
		String oName = request.getParameter("oName");
		String time = request.getParameter("time");
		String mark = request.getParameter("mark");
		String page = request.getParameter("page");
    	String rows = request.getParameter("rows");
    	Map<String, Object> map = new HashMap<String, Object>();
    	map.put("date1", date1);
    	map.put("date2", date2);
    	map.put("fcydept", fcydept);
    	map.put("fzzDoc", fzzDoc);
    	map.put("fprn", fprn);
    	map.put("fname", fname);
    	map.put("jbType", jbType);
    	map.put("jbName", jbName);
    	map.put("oType", oType);
    	map.put("oName", oName);
    	map.put("time", time);
    	map.put("mark", mark);
    	map.put("page", page);
    	map.put("rows", rows);
    	PageHelper result=null;
		try {
			result = archivingService.queryBrowseHistory(map);
		} catch (Exception e) {
			e.printStackTrace();
		}
    	return result;
	}
	
	/**
	 * 加载浏览历史页面tree
	 * @param request
	 * @return
	 */
	@RequestMapping("/tree")
    @ResponseBody 
    public Object tree(HttpServletRequest request){
	/*	//获取今天
		Map<String, Object> todayMap = archivingService.getToday();
		//获取本周
		Map<String, Object> thisMap = archivingService.getThisWeek();
		//获取上周
		Map<String, Object> lastMap = archivingService.getLastWeek();*/
		//获取每年和每月
		List<Map<String, Object>> yearList=null;
		try {
			yearList = archivingService.getAllYear();
		} catch (Exception e) {
			e.printStackTrace();
		}
		List<Map<String, Object>> oneList = new ArrayList<Map<String,Object>>();
		List<Map<String, Object>> twoList = new ArrayList<Map<String,Object>>();
		List<Map<String, Object>> threeList = new ArrayList<Map<String,Object>>();
		Map<String, Object> oneMap = new HashMap<String, Object>();
		//顶级菜单
		oneMap.put("id", "001");
		oneMap.put("text", "全部日期");
		oneMap.put("attributes", "all");
		oneMap.put("children", twoList);
		oneList.add(oneMap);
		//第二级节点
		Map<String, Object> twoMap_to = new HashMap<String, Object>();
		twoMap_to.put("id", "0001");
		twoMap_to.put("text", "今天");
		twoMap_to.put("attributes", "today");
		twoMap_to.put("children", "");
		Map<String, Object> twoMap_this = new HashMap<String, Object>();
		twoMap_this.put("id", "0002");
		twoMap_this.put("text", "本周");
		twoMap_this.put("attributes", "thisWeek");
		twoMap_this.put("children", "");
		Map<String, Object> twoMap_la = new HashMap<String, Object>();
		twoMap_la.put("id", "0003");
		twoMap_la.put("text", "上周");
		twoMap_la.put("attributes", "lastWeek");
		twoMap_la.put("children", "");
		twoList.add(twoMap_to);
		twoList.add(twoMap_this);
		twoList.add(twoMap_la);
		//遍历每一年
		Map<String, Object> fourMap = new HashMap<String, Object>();
		for (int i = 0; i < yearList.size(); i++) {
			Map<String, Object> threeMap = yearList.get(i);
			if(!fourMap.containsKey(threeMap.get("fyear"))){
				fourMap.put(String.valueOf(threeMap.get("fyear")), threeMap);
			}
		}
		int count = 1;
		for(Map.Entry<String, Object> entry : fourMap.entrySet()){
			//二级节点
			String year = entry.getKey();
			//Map<String, Object> value = (Map<String, Object>) entry.getValue();
			Map<String, Object> fiveMap = new HashMap<String, Object>();
			fiveMap.put("id", count);
			fiveMap.put("text", year + "年");
			fiveMap.put("attributes","year");
			fiveMap.put("children", threeList);
			count++;
			//第三级节点
			for (int i = 0; i < yearList.size(); i++) {
				Map<String, Object> month = yearList.get(i);
				Map<String, Object> sixMap = new HashMap<String, Object>();
				if(year.equals(String.valueOf(month.get("fyear")))){
					sixMap.put("id", i+1);
					sixMap.put("attributes", "month");
					sixMap.put("text", month.get("fmonth") + "月");
					threeList.add(sixMap);
				}
			}
			twoList.add(fiveMap);
		}
		return oneList;
	}
	
	/**
	 * 获取所有浏览人姓名
	 * @param request
	 * @return
	 */
	@RequestMapping("/getAllBrowseName")
    @ResponseBody 
    public Object getAllBrowseName(HttpServletRequest request){
		List<Map<String, Object>> resultList=null;
		try {
			resultList = archivingService.getAllBrowseName();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return resultList;
	}
	
	/**
	 * 查询浏览日志
	 * @param request
	 * @return
	 */
	@RequestMapping("/queryBrowseLog")
    @ResponseBody 
    public Object queryBrowseLog(HttpServletRequest request){
		String date1 = request.getParameter("date1");
		String date2 = request.getParameter("date2");
		String fcydept = request.getParameter("fcydept");
		String browseName = request.getParameter("browseName");
		String type = request.getParameter("type");
		String page = request.getParameter("page");
    	String rows = request.getParameter("rows");
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("date1", date1);
		map.put("date2", date2);
		map.put("fcydept", fcydept);
		map.put("browseName", browseName);
		map.put("type", type);
		map.put("page", page);
		map.put("rows", rows);
		PageHelper pageHepler=null;
		try {
			pageHepler = archivingService.queryBrowseLog(map);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return pageHepler;
	}
	
	/**
	 * 病案归档页面-集中归档
	 * @param request
	 * @return
	 */
	@RequestMapping("/archivingOperation")
    @ResponseBody 
    public Object archivingOperation(HttpServletRequest request){
		long a=System.currentTimeMillis();
		/*当前用户信息*/
		Tsysuser user = (Tsysuser) request.getSession().getAttribute(GlobalStatic.USER_SESSION_OBJECT);
		/*密码解密*/
		String pwd=CryptoUtil.aesDecrypt(user.getFpassword());
		
		
		String fprn = request.getParameter("fprn");
		String fzyid = request.getParameter("fzyid");
		String fname = request.getParameter("fname");
		Integer ftimes = Integer.parseInt(request.getParameter("ftimes"));
		
		/*
		 * 1.对原文件进行加密，并上传至ftp服务器。
		 * 2.对原文件进行ca签名，并上传至ftp服务器。
		 * 3.删除本地服务器原文件。
		 * */
		/*取资源文档目录*/
		String path = Thread.currentThread().getContextClassLoader().getResource("").getPath();
		/*读取配置文件*/
		Map<String,String> prop=SetSystemProperty.propertiesToMap(path+"/config.properties");
		/*取项目根目录*/
		String strDirPath = request.getSession().getServletContext().getRealPath("/");
		
		/*病案集中归档-源文件保存目录*/
		String sourcepath=strDirPath+prop.get("archive.pdf.path")+fprn+"\\"+ftimes;
		
		/*病案集中归档-签名临时保存目录*/
		String signpath=strDirPath+prop.get("temp.sign.pdf.path")+fprn+"\\"+ftimes;
		/*创建多级目录*/
		FileUtil.createMultilayerFile(signpath);
		
		/*病案集中归档-加密临时保存目录*/
		String encryptpath=strDirPath+prop.get("temp.encrypt.pdf.path")+fprn+"\\"+ftimes;
		/*创建多级目录*/
		FileUtil.createMultilayerFile(encryptpath);
		
		File folder =new File(sourcepath);    
		/*判断目录是否存在*/
		if(folder.exists() || folder.isDirectory()){  
			File [] files = folder.listFiles();
			 /*判断文件夹是否为空*/
            if(files !=null && files.length > 0){
            	for (File file : files) {
            		try {
            			/*源文件路径*/
                		String sourceFile=file.getPath();
                		/**********************1.ca签名文件并上传至服务器-开始*************************/
                		/*ca签名文件-临时保存文件*/
                		String signFile=signpath+"\\"+file.getName();
                		/*创建ca签名临时文件*/
                		FileUtil.createFile(signFile);
                		/*当前用户证书*/
                		Certificate cert= CAUtil.getLoginCert(user.getFnetcasn());
                		/*对源文件进行ca签名*/
                		CAUtil.signFile(sourceFile,signFile,cert,pwd);
                		/*FTP上传-将ca签名后的文档上传至服务器*/
                		FTPUtil.uploadFile(prop.get("ftp.sign.pdf.path")+fprn+"\\"+ftimes,file.getName(), new FileInputStream(signFile));
                		/**********************1.ca签名文件并上传至服务器-结束*************************/
                		
                		/**********************2.文件加密并上传至服务器-开始*************************/
                		/*加密文件-临时保存文件*/
                		String encryptFile=encryptpath+"\\"+file.getName();
                		/*对源文件进行加密*/
                		new FileEncodeAndDecode(prop.get("encrypt.key")).encrypt(sourceFile,encryptFile);
                		/*FTP上传-将ca签名后的文档上传至服务器*/
                		FTPUtil.uploadFile(prop.get("ftp.encrypt.pdf.path")+fprn+"\\"+ftimes,file.getName(), new FileInputStream(encryptFile));
                		/**********************2.文件加密并上传至服务器-结束*************************/
                		
                		/**********************3.将归档详情写入数据库-开始*************************/
                		archivingService.updateBagdmx(fprn, ftimes+"", file.getName().substring(0,file.getName().lastIndexOf(".")), prop.get("ftp.encrypt.pdf.path")+fprn+"\\"+ftimes+"\\"+file.getName(), prop.get("ftp.sign.pdf.path")+fprn+"\\"+ftimes+"\\"+file.getName());
                		/**********************3.将归档详情写入数据库-结束*************************/
            		} catch (Exception e) {
    					e.printStackTrace();
    					return e.getMessage();
    				}
            	}
            }
		}
		/****************删除目录*****************/
		try {
			//增加归档
			this.archivingService.addArchived(fprn, ftimes+"","1");
			/*1.删除本地源文件目录*/
			FileUtil.deleteDirectory(sourcepath);
			/*2.删除本地ca签名文件临时目录*/
			FileUtil.deleteDirectory(signpath);
			/*3.删除本地加密文件临时目录*/
			FileUtil.deleteDirectory(encryptpath);
		} catch (Exception e) {
			e.printStackTrace();
			return e.getMessage();
		}
		System.out.println("归档执行耗时 : "+(System.currentTimeMillis()-a)/1000f+" 秒 ");
		return true;
	}
	
	/**
	 * 获取申请记录
	 * @param request
	 * @return
	 */
	@RequestMapping("/getApplyRecord")
    @ResponseBody 
    public Object getApplyRecord(HttpServletRequest request){
		String date1 = request.getParameter("date1"); 	//出院日期
		String date2 = request.getParameter("date2"); 	//出院日期
		String fcydept = request.getParameter("fcydept");	//出院科室
		String fzzDoc = request.getParameter("fzzDoc");	//主治医生
		String fprn = request.getParameter("fprn");		//病案号
		String fname = request.getParameter("fname");	//姓名
		String type = request.getParameter("type");		//申请日期/出院日期
		String status = request.getParameter("status");	//审批状态
		String purpose = request.getParameter("purpose");	//申请目的
		String page = request.getParameter("page");
    	String rows = request.getParameter("rows");
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("date1", date1);
		map.put("date2", date2);
		map.put("fcydept", fcydept);
		map.put("fzzDoc", fzzDoc);
		map.put("fprn", fprn);
		map.put("fname", fname);
		map.put("type", type);
		map.put("status", status);
		map.put("purpose", purpose);
		map.put("page", page);
		map.put("rows", rows);
		PageHelper result=null;
		try {
			result = archivingService.getApplyRecord(map);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return result;
	}
	
	
	/**
	 * 获取申请详细记录
	 * @param request
	 * @return
	 */
	@RequestMapping("/getApplyDetails")
    @ResponseBody 
    public Object getApplyDetails(HttpServletRequest request){
		String fzyid = request.getParameter("fid"); //单个申请id，非住院id
		List<Map<String, Object>> list=null;
		try {
			list = archivingService.getApplyDetails(fzyid);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
	
	/**
	 * 获取批量申请记录
	 * @param request
	 * @return
	 */
	@RequestMapping("/getBatchApplyRecord")
    @ResponseBody 
    public Object getBatchApplyRecord(HttpServletRequest request){
		String date1 = request.getParameter("date1");
		String date2 = request.getParameter("date2");
		String purpose = request.getParameter("purpose");
		String status = request.getParameter("status");
		String page = request.getParameter("page");
    	String rows = request.getParameter("rows");
    	Map<String, Object> map = new HashMap<String, Object>();
    	map.put("date1", date1);
    	map.put("date2", date2);
    	map.put("purpose", purpose);
    	map.put("status", status);
    	map.put("page", page);
    	map.put("rows", rows);
    	PageHelper resultPage=null;
		try {
			resultPage = archivingService.getBatchApplyRecord(map);
		} catch (Exception e) {
			e.printStackTrace();
		}
    	return resultPage;
	}
	
	/**
	 * 获取批量申请详情
	 * @param request
	 * @return
	 */
	@RequestMapping("/getBatchApplyDetails")
    @ResponseBody 
    public Object getBatchApplyDetails(HttpServletRequest request){
		String fsqid = request.getParameter("fsqid");
		List<Map<String, Object>> list=null;
		try {
			list = archivingService.getBatchApplyDetails(fsqid);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
	
	/**
	 * 根据申请ID获取批量申请列表页数据
	 * @param request
	 * @return
	 */
	@RequestMapping("/getBatchList")
    @ResponseBody 
    public Object getBatchList(HttpServletRequest request){
		String fsqid = request.getParameter("fsqid");
		String page = request.getParameter("page");
    	String rows = request.getParameter("rows");
    	Map<String, Object> map = new HashMap<String, Object>();
    	map.put("fsqid", fsqid);
    	map.put("page", page);
    	map.put("rows", rows);
    	PageHelper resultPage=null;
		try {
			resultPage = archivingService.getBatchList(map);
		} catch (Exception e) {
			e.printStackTrace();
		}
    	return resultPage;
	}
}
